package com.tsystems.skilltest;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "transactions")
@XmlAccessorType(XmlAccessType.FIELD)
public class TransactionList
{
    @XmlElement(name = "transaction")
    private List<Transaction> transactions;

    public TransactionList()
    {
    }

    public TransactionList(List<Transaction> transactions)
    {
        this.transactions = new ArrayList<Transaction>(transactions);
    }

    public List<Transaction> getTransactions()
    {
        return new ArrayList<Transaction>(transactions);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TransactionList that = (TransactionList) o;

        if (transactions != null ? !transactions.equals(that.transactions) : that.transactions != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        return transactions != null ? transactions.hashCode() : 0;
    }
}
